# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: Exp $

EAPI=2
inherit eutils autotools

XROOTD_VER="3.0.5"

DESCRIPTION="ALICE ${PN} for xrootd"
HOMEPAGE="http://project-arda-dev.web.cern.ch/project-arda-dev/xrootd/site/index.html"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
IUSE=""

XROOTD_DIR="/opt/cern/alice/xrootd"


INS_DIR="/opt/cern/alice/alien"
SLOT="${PV}"

RDEPEND="dev-libs/libxml2
  dev-util/pkgconfig
  >=sci-physics/eselect-xrootd-1.1.0
  >=sci-physics/eselect-alien-2.0.3
  >=sci-physics/eselect-alice-1.9.7
  =sci-physics/xrootd-${XROOTD_VER}-r2
  ${XRD_DEPEND}"

CDEPEND="${RDEPEND}"

DEPEND="${CDEPEND}"
# SRC_URI="http://project-arda-dev.web.cern.ch/project-arda-dev/alice/xalienfs/xrootd-xalienfs-${PV}.tar.gz"
SRC_URI="http://alitorrent.cern.ch/src/xalienfs/xrootd-xalienfs-${PV}.tar.gz"
S="${WORKDIR}/xrootd-xalienfs-${PV}"

src_configure() {
  rm -Rf autom4te.cache
  ./bootstrap.sh
  cd $S
  ./configure \
  --prefix=${INS_DIR}/${SLOT} \
  --with-certificate-directory=${D}/${INS_DIR}/${SLOT}/share \
  --with-xrootd-location=$XROOTD_DIR/${XROOTD_VER} \
  || die "configure failed"
}


src_install() {
  emake DESTDIR="${D}" install || die "emake install failed"
  emake DESTDIR="${D}" install-certificates || die "emake install-certificates failed"
}
